﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AZShop.Macros.DataAccess
{
    public interface IProductRepository
    {
        IList<CSK_Store_Product> GetProductsByDate(int categoryId);
    }

    public class ProductRepository : IProductRepository
    {

        private azshopEntities entities = new azshopEntities();

        public IList<CSK_Store_Product> GetProductsByDate(int categoryId)
        {
            IQueryable<CSK_Store_Product> result = from pc in entities.CSK_Store_Product_Category_Map
                                         where pc.categoryID == categoryId
                                         select pc.CSK_Store_Product;

            return result.ToList<CSK_Store_Product>();
                                         
        }
    }
}
